#include "SuperData.h"

SuperData* SuperData::Instance()
{
	static SuperData instance;
	return &instance;
}

void SuperData::LoadData(const MapData& mapData)
{
	map_width		=	mapData.w;
	map_height		=	mapData.h;

	MapName			=	mapData.MapName;
	MapScriptPath	=	mapData.MapScript;
	MapPath			=	mapData.MapPath;
	NavPath			=	mapData.NavPath;
	MusicName		=	"LosingTouch";

}

void SuperData::LoadSettings(string filename)
{

	Lua->RunScript(filename.c_str());
	
	// Item Name			=	Item Type				Item Name in Lua				Default Item Value
	MapToNavFileCreatorPath =	Lua->GetGlobalStr("MAPTONAVFILECREATOR_PATH_SETTING",	"INVALID MAPTONAVFILECREATOR_PATH_SETTING PATH");

	SoundVolume				=	Lua->GetGlobalNum("SOUND_VOLUME_SETTING"			,	0.0);
	WINDOW_WIDTH			=	Lua->GetGlobalNum("WINDOW_WIDTH_SETTING"			,	900);
	WINDOW_HEIGHT			=	Lua->GetGlobalNum("WINDOW_HEIGHT_SETTING"			,	600);
	WINDOW_BPP				=	Lua->GetGlobalNum("WINDOW_BPP"						,	32);

	string data = Lua->GetGlobalStr("FULLSCREEN_SETTING", "sup");
	if(data == "false")
		fullscreen = false;
	else
		fullscreen = true;

	data = Lua->GetGlobalStr("PLAY_MUSIC_SETTING", "false");
	if(data == "false")
		PlayMusic = false;
	else
		PlayMusic = true;


}

SuperData::SuperData()
{
	// Some default values
	MapToNavFileCreatorPath = "MapToNavFileCreator.exe";
	SoundVolume = 34;
	PlayMusic = 0;
	fullscreen = false;

	WINDOW_WIDTH = 900;
	WINDOW_HEIGHT = 600;
	WINDOW_BPP = 32;


}